using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
using System.Threading;

using MT.eVotePRS.Common;
using log4net;

namespace MT.eVotePRS.UI
{
    static class Program
    {
        static ILog mLog = LogManager.GetLogger(typeof(Program));

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            bool ok;
            Mutex m = new Mutex(true, "Global\\" + "Personal Response SystemMutex", out ok);

            if (!ok)
            {
                DialogBox.boxError(string.Format("{0} has been running.", Constants.AssemblyProduct));
                return;
            }

            //log4net.GlobalContext.Properties["AppLog"] = Constants.AppLogFile;
            //if (File.Exists(Constants.Log4NetConfigFileName))
            //{
            //    log4net.Config.XmlConfigurator.Configure(new FileInfo(Constants.Log4NetConfigFileName));
            //}

            Application.Run(new frmMain());

            GC.KeepAlive(m);
        }

        public static MT.eVotePRS.Device.ARSAPIHelper ArsAPIHelper;
    }
}